3.2.83 \(\int \csc ^4(c+d x) (a+b \sec (c+d x))^2 \, dx\) [183]

3.2.83.1 Optimal result
3.2.83.2 Mathematica [B] (verified)
3.2.83.3 Rubi [A] (verified)
3.2.83.4 Maple [A] (verified)
3.2.83.5 Fricas [A] (verification not implemented)
3.2.83.6 Sympy [F]
3.2.83.7 Maxima [A] (verification not implemented)
3.2.83.8 Giac [B] (verification not implemented)
3.2.83.9 Mupad [B] (verification not implemented)

3.2.83.1 Optimal result

Integrand size = 21, antiderivative size = 100 \[ \int \csc ^4(c+d x) (a+b \sec (c+d x))^2 \, dx=\frac {2 a b \text {arctanh}(\sin (c+d x))}{d}-\frac {\left (a^2+2 b^2\right ) \cot (c+d x)}{d}-\frac {\left (a^2+b^2\right ) \cot ^3(c+d x)}{3 d}-\frac {2 a b \csc (c+d x)}{d}-\frac {2 a b \csc ^3(c+d x)}{3 d}+\frac {b^2 \tan (c+d x)}{d} \]

output
2*a*b*arctanh(sin(d*x+c))/d-(a^2+2*b^2)*cot(d*x+c)/d-1/3*(a^2+b^2)*cot(d*x 
+c)^3/d-2*a*b*csc(d*x+c)/d-2/3*a*b*csc(d*x+c)^3/d+b^2*tan(d*x+c)/d
 
3.2.83.2 Mathematica [B] (verified)

Leaf count is larger than twice the leaf count of optimal. \(259\) vs. \(2(100)=200\).

Time = 1.28 (sec) , antiderivative size = 259, normalized size of antiderivative = 2.59 \[ \int \csc ^4(c+d x) (a+b \sec (c+d x))^2 \, dx=\frac {\csc ^5\left (\frac {1}{2} (c+d x)\right ) \sec ^3\left (\frac {1}{2} (c+d x)\right ) \left (-3 a^2-14 a b \cos (c+d x)-2 \left (a^2+4 b^2\right ) \cos (2 (c+d x))+6 a b \cos (3 (c+d x))+a^2 \cos (4 (c+d x))+4 b^2 \cos (4 (c+d x))-6 a b \log \left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right ) \sin (2 (c+d x))+6 a b \log \left (\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )\right ) \sin (2 (c+d x))+3 a b \log \left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right ) \sin (4 (c+d x))-3 a b \log \left (\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )\right ) \sin (4 (c+d x))\right )}{96 d \left (-1+\cot ^2\left (\frac {1}{2} (c+d x)\right )\right )} \]

input
Integrate[Csc[c + d*x]^4*(a + b*Sec[c + d*x])^2,x]
 
output
(Csc[(c + d*x)/2]^5*Sec[(c + d*x)/2]^3*(-3*a^2 - 14*a*b*Cos[c + d*x] - 2*( 
a^2 + 4*b^2)*Cos[2*(c + d*x)] + 6*a*b*Cos[3*(c + d*x)] + a^2*Cos[4*(c + d* 
x)] + 4*b^2*Cos[4*(c + d*x)] - 6*a*b*Log[Cos[(c + d*x)/2] - Sin[(c + d*x)/ 
2]]*Sin[2*(c + d*x)] + 6*a*b*Log[Cos[(c + d*x)/2] + Sin[(c + d*x)/2]]*Sin[ 
2*(c + d*x)] + 3*a*b*Log[Cos[(c + d*x)/2] - Sin[(c + d*x)/2]]*Sin[4*(c + d 
*x)] - 3*a*b*Log[Cos[(c + d*x)/2] + Sin[(c + d*x)/2]]*Sin[4*(c + d*x)]))/( 
96*d*(-1 + Cot[(c + d*x)/2]^2))
 
3.2.83.3 Rubi [A] (verified)

Time = 0.69 (sec) , antiderivative size = 87, normalized size of antiderivative = 0.87, number of steps used = 14, number of rules used = 13, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.619, Rules used = {3042, 4360, 3042, 3390, 25, 3042, 3101, 25, 254, 2009, 4889, 355, 2009}

Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.

\(\displaystyle \int \csc ^4(c+d x) (a+b \sec (c+d x))^2 \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \frac {\left (a-b \csc \left (c+d x-\frac {\pi }{2}\right )\right )^2}{\cos \left (c+d x-\frac {\pi }{2}\right )^4}dx\)

\(\Big \downarrow \) 4360

\(\displaystyle \int \csc ^4(c+d x) \sec ^2(c+d x) (-a \cos (c+d x)-b)^2dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \frac {\left (a \sin \left (c+d x-\frac {\pi }{2}\right )-b\right )^2}{\sin \left (c+d x-\frac {\pi }{2}\right )^2 \cos \left (c+d x-\frac {\pi }{2}\right )^4}dx\)

\(\Big \downarrow \) 3390

\(\displaystyle \int \left (b^2+a^2 \cos ^2(c+d x)\right ) \csc ^4(c+d x) \sec ^2(c+d x)dx-2 a b \int -\csc ^4(c+d x) \sec (c+d x)dx\)

\(\Big \downarrow \) 25

\(\displaystyle \int \left (b^2+a^2 \cos ^2(c+d x)\right ) \csc ^4(c+d x) \sec ^2(c+d x)dx+2 a b \int \csc ^4(c+d x) \sec (c+d x)dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \frac {b^2+a^2 \cos (c+d x)^2}{\cos (c+d x)^2 \sin (c+d x)^4}dx+2 a b \int \csc (c+d x)^4 \sec (c+d x)dx\)

\(\Big \downarrow \) 3101

\(\displaystyle \int \frac {b^2+a^2 \cos (c+d x)^2}{\cos (c+d x)^2 \sin (c+d x)^4}dx-\frac {2 a b \int -\frac {\csc ^4(c+d x)}{1-\csc ^2(c+d x)}d\csc (c+d x)}{d}\)

\(\Big \downarrow \) 25

\(\displaystyle \int \frac {b^2+a^2 \cos (c+d x)^2}{\cos (c+d x)^2 \sin (c+d x)^4}dx+\frac {2 a b \int \frac {\csc ^4(c+d x)}{1-\csc ^2(c+d x)}d\csc (c+d x)}{d}\)

\(\Big \downarrow \) 254

\(\displaystyle \int \frac {b^2+a^2 \cos (c+d x)^2}{\cos (c+d x)^2 \sin (c+d x)^4}dx+\frac {2 a b \int \left (-\csc ^2(c+d x)+\frac {1}{1-\csc ^2(c+d x)}-1\right )d\csc (c+d x)}{d}\)

\(\Big \downarrow \) 2009

\(\displaystyle \int \frac {b^2+a^2 \cos (c+d x)^2}{\cos (c+d x)^2 \sin (c+d x)^4}dx-\frac {2 a b \left (-\text {arctanh}(\csc (c+d x))+\frac {1}{3} \csc ^3(c+d x)+\csc (c+d x)\right )}{d}\)

\(\Big \downarrow \) 4889

\(\displaystyle \frac {\int \cot ^4(c+d x) \left (\tan ^2(c+d x)+1\right ) \left (a^2+b^2+b^2 \tan ^2(c+d x)\right )d\tan (c+d x)}{d}-\frac {2 a b \left (-\text {arctanh}(\csc (c+d x))+\frac {1}{3} \csc ^3(c+d x)+\csc (c+d x)\right )}{d}\)

\(\Big \downarrow \) 355

\(\displaystyle \frac {\int \left (\left (a^2+b^2\right ) \cot ^4(c+d x)+\left (a^2+2 b^2\right ) \cot ^2(c+d x)+b^2\right )d\tan (c+d x)}{d}-\frac {2 a b \left (-\text {arctanh}(\csc (c+d x))+\frac {1}{3} \csc ^3(c+d x)+\csc (c+d x)\right )}{d}\)

\(\Big \downarrow \) 2009

\(\displaystyle \frac {-\frac {1}{3} \left (a^2+b^2\right ) \cot ^3(c+d x)-\left (a^2+2 b^2\right ) \cot (c+d x)+b^2 \tan (c+d x)}{d}-\frac {2 a b \left (-\text {arctanh}(\csc (c+d x))+\frac {1}{3} \csc ^3(c+d x)+\csc (c+d x)\right )}{d}\)

input
Int[Csc[c + d*x]^4*(a + b*Sec[c + d*x])^2,x]
 
output
(-2*a*b*(-ArcTanh[Csc[c + d*x]] + Csc[c + d*x] + Csc[c + d*x]^3/3))/d + (- 
((a^2 + 2*b^2)*Cot[c + d*x]) - ((a^2 + b^2)*Cot[c + d*x]^3)/3 + b^2*Tan[c 
+ d*x])/d
 

3.2.83.3.1 Defintions of rubi rules used

rule 25
Int[-(Fx_), x_Symbol] :> Simp[Identity[-1]   Int[Fx, x], x]
 

rule 254
Int[(x_)^(m_)/((a_) + (b_.)*(x_)^2), x_Symbol] :> Int[PolynomialDivide[x^m, 
 a + b*x^2, x], x] /; FreeQ[{a, b}, x] && IGtQ[m, 3]
 

rule 355
Int[((e_.)*(x_))^(m_.)*((a_) + (b_.)*(x_)^2)^(p_.)*((c_) + (d_.)*(x_)^2)^(q 
_.), x_Symbol] :> Int[ExpandIntegrand[(e*x)^m*(a + b*x^2)^p*(c + d*x^2)^q, 
x], x] /; FreeQ[{a, b, c, d, e, m}, x] && NeQ[b*c - a*d, 0] && IGtQ[p, 0] & 
& IGtQ[q, 0]
 

rule 2009
Int[u_, x_Symbol] :> Simp[IntSum[u, x], x] /; SumQ[u]
 

rule 3042
Int[u_, x_Symbol] :> Int[DeactivateTrig[u, x], x] /; FunctionOfTrigOfLinear 
Q[u, x]
 

rule 3101
Int[(csc[(e_.) + (f_.)*(x_)]*(a_.))^(m_)*sec[(e_.) + (f_.)*(x_)]^(n_.), x_S 
ymbol] :> Simp[-(f*a^n)^(-1)   Subst[Int[x^(m + n - 1)/(-1 + x^2/a^2)^((n + 
 1)/2), x], x, a*Csc[e + f*x]], x] /; FreeQ[{a, e, f, m}, x] && IntegerQ[(n 
 + 1)/2] &&  !(IntegerQ[(m + 1)/2] && LtQ[0, m, n])
 

rule 3390
Int[(cos[(e_.) + (f_.)*(x_)]*(g_.))^(p_)*((d_.)*sin[(e_.) + (f_.)*(x_)])^(n 
_)*((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^2, x_Symbol] :> Simp[2*a*(b/d) 
Int[(g*Cos[e + f*x])^p*(d*Sin[e + f*x])^(n + 1), x], x] + Int[(g*Cos[e + f* 
x])^p*(d*Sin[e + f*x])^n*(a^2 + b^2*Sin[e + f*x]^2), x] /; FreeQ[{a, b, d, 
e, f, g, n, p}, x] && NeQ[a^2 - b^2, 0]
 

rule 4360
Int[(cos[(e_.) + (f_.)*(x_)]*(g_.))^(p_.)*(csc[(e_.) + (f_.)*(x_)]*(b_.) + 
(a_))^(m_.), x_Symbol] :> Int[(g*Cos[e + f*x])^p*((b + a*Sin[e + f*x])^m/Si 
n[e + f*x]^m), x] /; FreeQ[{a, b, e, f, g, p}, x] && IntegerQ[m]
 

rule 4889
Int[u_, x_Symbol] :> With[{v = FunctionOfTrig[u, x]}, With[{d = FreeFactors 
[Tan[v], x]}, Simp[d/Coefficient[v, x, 1]   Subst[Int[SubstFor[1/(1 + d^2*x 
^2), Tan[v]/d, u, x], x], x, Tan[v]/d], x]] /;  !FalseQ[v] && FunctionOfQ[N 
onfreeFactors[Tan[v], x], u, x]] /; InverseFunctionFreeQ[u, x] &&  !MatchQ[ 
u, (v_.)*((c_.)*tan[w_]^(n_.)*tan[z_]^(n_.))^(p_.) /; FreeQ[{c, p}, x] && I 
ntegerQ[n] && LinearQ[w, x] && EqQ[z, 2*w]]
 
3.2.83.4 Maple [A] (verified)

Time = 1.67 (sec) , antiderivative size = 116, normalized size of antiderivative = 1.16

method result size
derivativedivides \(\frac {a^{2} \left (-\frac {2}{3}-\frac {\csc \left (d x +c \right )^{2}}{3}\right ) \cot \left (d x +c \right )+2 a b \left (-\frac {1}{3 \sin \left (d x +c \right )^{3}}-\frac {1}{\sin \left (d x +c \right )}+\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )\right )+b^{2} \left (-\frac {1}{3 \sin \left (d x +c \right )^{3} \cos \left (d x +c \right )}+\frac {4}{3 \sin \left (d x +c \right ) \cos \left (d x +c \right )}-\frac {8 \cot \left (d x +c \right )}{3}\right )}{d}\) \(116\)
default \(\frac {a^{2} \left (-\frac {2}{3}-\frac {\csc \left (d x +c \right )^{2}}{3}\right ) \cot \left (d x +c \right )+2 a b \left (-\frac {1}{3 \sin \left (d x +c \right )^{3}}-\frac {1}{\sin \left (d x +c \right )}+\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )\right )+b^{2} \left (-\frac {1}{3 \sin \left (d x +c \right )^{3} \cos \left (d x +c \right )}+\frac {4}{3 \sin \left (d x +c \right ) \cos \left (d x +c \right )}-\frac {8 \cot \left (d x +c \right )}{3}\right )}{d}\) \(116\)
parallelrisch \(\frac {-96 a b \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right ) \cos \left (d x +c \right )+96 a b \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right ) \cos \left (d x +c \right )-\sec \left (\frac {d x}{2}+\frac {c}{2}\right )^{3} \left (\left (a^{2}+4 b^{2}\right ) \cos \left (2 d x +2 c \right )+\left (-\frac {a^{2}}{2}-2 b^{2}\right ) \cos \left (4 d x +4 c \right )+\frac {3 a \left (\frac {14 \cos \left (d x +c \right ) b}{3}-2 b \cos \left (3 d x +3 c \right )+a \right )}{2}\right ) \csc \left (\frac {d x}{2}+\frac {c}{2}\right )^{3}}{48 d \cos \left (d x +c \right )}\) \(150\)
risch \(-\frac {4 i \left (3 a b \,{\mathrm e}^{7 i \left (d x +c \right )}-7 a b \,{\mathrm e}^{5 i \left (d x +c \right )}-3 a^{2} {\mathrm e}^{4 i \left (d x +c \right )}-7 a b \,{\mathrm e}^{3 i \left (d x +c \right )}-2 a^{2} {\mathrm e}^{2 i \left (d x +c \right )}-8 b^{2} {\mathrm e}^{2 i \left (d x +c \right )}+3 a b \,{\mathrm e}^{i \left (d x +c \right )}+a^{2}+4 b^{2}\right )}{3 d \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right ) \left ({\mathrm e}^{2 i \left (d x +c \right )}-1\right )^{3}}+\frac {2 a b \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right )}{d}-\frac {2 a b \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right )}{d}\) \(177\)
norman \(\frac {\frac {a^{2}+2 a b +b^{2}}{24 d}-\frac {3 \left (a^{2}+5 b^{2}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{4}}{4 d}+\frac {\left (a^{2}-2 a b +b^{2}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{8}}{24 d}+\frac {\left (2 a^{2}-7 a b +5 b^{2}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{6}}{6 d}+\frac {\left (2 a^{2}+7 a b +5 b^{2}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}}{6 d}}{\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{3} \left (-1+\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}\right )}-\frac {2 a b \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{d}+\frac {2 a b \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{d}\) \(198\)

input
int(csc(d*x+c)^4*(a+b*sec(d*x+c))^2,x,method=_RETURNVERBOSE)
 
output
1/d*(a^2*(-2/3-1/3*csc(d*x+c)^2)*cot(d*x+c)+2*a*b*(-1/3/sin(d*x+c)^3-1/sin 
(d*x+c)+ln(sec(d*x+c)+tan(d*x+c)))+b^2*(-1/3/sin(d*x+c)^3/cos(d*x+c)+4/3/s 
in(d*x+c)/cos(d*x+c)-8/3*cot(d*x+c)))
 
3.2.83.5 Fricas [A] (verification not implemented)

Time = 0.27 (sec) , antiderivative size = 178, normalized size of antiderivative = 1.78 \[ \int \csc ^4(c+d x) (a+b \sec (c+d x))^2 \, dx=-\frac {6 \, a b \cos \left (d x + c\right )^{3} + 2 \, {\left (a^{2} + 4 \, b^{2}\right )} \cos \left (d x + c\right )^{4} - 8 \, a b \cos \left (d x + c\right ) - 3 \, {\left (a^{2} + 4 \, b^{2}\right )} \cos \left (d x + c\right )^{2} - 3 \, {\left (a b \cos \left (d x + c\right )^{3} - a b \cos \left (d x + c\right )\right )} \log \left (\sin \left (d x + c\right ) + 1\right ) \sin \left (d x + c\right ) + 3 \, {\left (a b \cos \left (d x + c\right )^{3} - a b \cos \left (d x + c\right )\right )} \log \left (-\sin \left (d x + c\right ) + 1\right ) \sin \left (d x + c\right ) + 3 \, b^{2}}{3 \, {\left (d \cos \left (d x + c\right )^{3} - d \cos \left (d x + c\right )\right )} \sin \left (d x + c\right )} \]

input
integrate(csc(d*x+c)^4*(a+b*sec(d*x+c))^2,x, algorithm="fricas")
 
output
-1/3*(6*a*b*cos(d*x + c)^3 + 2*(a^2 + 4*b^2)*cos(d*x + c)^4 - 8*a*b*cos(d* 
x + c) - 3*(a^2 + 4*b^2)*cos(d*x + c)^2 - 3*(a*b*cos(d*x + c)^3 - a*b*cos( 
d*x + c))*log(sin(d*x + c) + 1)*sin(d*x + c) + 3*(a*b*cos(d*x + c)^3 - a*b 
*cos(d*x + c))*log(-sin(d*x + c) + 1)*sin(d*x + c) + 3*b^2)/((d*cos(d*x + 
c)^3 - d*cos(d*x + c))*sin(d*x + c))
 
3.2.83.6 Sympy [F]

\[ \int \csc ^4(c+d x) (a+b \sec (c+d x))^2 \, dx=\int \left (a + b \sec {\left (c + d x \right )}\right )^{2} \csc ^{4}{\left (c + d x \right )}\, dx \]

input
integrate(csc(d*x+c)**4*(a+b*sec(d*x+c))**2,x)
 
output
Integral((a + b*sec(c + d*x))**2*csc(c + d*x)**4, x)
 
3.2.83.7 Maxima [A] (verification not implemented)

Time = 0.20 (sec) , antiderivative size = 112, normalized size of antiderivative = 1.12 \[ \int \csc ^4(c+d x) (a+b \sec (c+d x))^2 \, dx=-\frac {a b {\left (\frac {2 \, {\left (3 \, \sin \left (d x + c\right )^{2} + 1\right )}}{\sin \left (d x + c\right )^{3}} - 3 \, \log \left (\sin \left (d x + c\right ) + 1\right ) + 3 \, \log \left (\sin \left (d x + c\right ) - 1\right )\right )} + b^{2} {\left (\frac {6 \, \tan \left (d x + c\right )^{2} + 1}{\tan \left (d x + c\right )^{3}} - 3 \, \tan \left (d x + c\right )\right )} + \frac {{\left (3 \, \tan \left (d x + c\right )^{2} + 1\right )} a^{2}}{\tan \left (d x + c\right )^{3}}}{3 \, d} \]

input
integrate(csc(d*x+c)^4*(a+b*sec(d*x+c))^2,x, algorithm="maxima")
 
output
-1/3*(a*b*(2*(3*sin(d*x + c)^2 + 1)/sin(d*x + c)^3 - 3*log(sin(d*x + c) + 
1) + 3*log(sin(d*x + c) - 1)) + b^2*((6*tan(d*x + c)^2 + 1)/tan(d*x + c)^3 
 - 3*tan(d*x + c)) + (3*tan(d*x + c)^2 + 1)*a^2/tan(d*x + c)^3)/d
 
3.2.83.8 Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 226 vs. \(2 (96) = 192\).

Time = 0.34 (sec) , antiderivative size = 226, normalized size of antiderivative = 2.26 \[ \int \csc ^4(c+d x) (a+b \sec (c+d x))^2 \, dx=\frac {a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 2 \, a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 48 \, a b \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1 \right |}\right ) - 48 \, a b \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1 \right |}\right ) + 9 \, a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 30 \, a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 21 \, b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - \frac {48 \, b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 1} - \frac {9 \, a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 30 \, a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 21 \, b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + a^{2} + 2 \, a b + b^{2}}{\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3}}}{24 \, d} \]

input
integrate(csc(d*x+c)^4*(a+b*sec(d*x+c))^2,x, algorithm="giac")
 
output
1/24*(a^2*tan(1/2*d*x + 1/2*c)^3 - 2*a*b*tan(1/2*d*x + 1/2*c)^3 + b^2*tan( 
1/2*d*x + 1/2*c)^3 + 48*a*b*log(abs(tan(1/2*d*x + 1/2*c) + 1)) - 48*a*b*lo 
g(abs(tan(1/2*d*x + 1/2*c) - 1)) + 9*a^2*tan(1/2*d*x + 1/2*c) - 30*a*b*tan 
(1/2*d*x + 1/2*c) + 21*b^2*tan(1/2*d*x + 1/2*c) - 48*b^2*tan(1/2*d*x + 1/2 
*c)/(tan(1/2*d*x + 1/2*c)^2 - 1) - (9*a^2*tan(1/2*d*x + 1/2*c)^2 + 30*a*b* 
tan(1/2*d*x + 1/2*c)^2 + 21*b^2*tan(1/2*d*x + 1/2*c)^2 + a^2 + 2*a*b + b^2 
)/tan(1/2*d*x + 1/2*c)^3)/d
 
3.2.83.9 Mupad [B] (verification not implemented)

Time = 14.68 (sec) , antiderivative size = 182, normalized size of antiderivative = 1.82 \[ \int \csc ^4(c+d x) (a+b \sec (c+d x))^2 \, dx=\frac {{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3\,{\left (a-b\right )}^2}{24\,d}-\frac {\frac {2\,a\,b}{3}-{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^4\,\left (3\,a^2+10\,a\,b+23\,b^2\right )+{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2\,\left (\frac {8\,a^2}{3}+\frac {28\,a\,b}{3}+\frac {20\,b^2}{3}\right )+\frac {a^2}{3}+\frac {b^2}{3}}{d\,\left (8\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3-8\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^5\right )}+\frac {\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\left (\frac {a^2}{8}-\frac {3\,a\,b}{4}+\frac {5\,b^2}{8}+\frac {{\left (a-b\right )}^2}{4}\right )}{d}+\frac {4\,a\,b\,\mathrm {atanh}\left (\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\right )}{d} \]

input
int((a + b/cos(c + d*x))^2/sin(c + d*x)^4,x)
 
output
(tan(c/2 + (d*x)/2)^3*(a - b)^2)/(24*d) - ((2*a*b)/3 - tan(c/2 + (d*x)/2)^ 
4*(10*a*b + 3*a^2 + 23*b^2) + tan(c/2 + (d*x)/2)^2*((28*a*b)/3 + (8*a^2)/3 
 + (20*b^2)/3) + a^2/3 + b^2/3)/(d*(8*tan(c/2 + (d*x)/2)^3 - 8*tan(c/2 + ( 
d*x)/2)^5)) + (tan(c/2 + (d*x)/2)*(a^2/8 - (3*a*b)/4 + (5*b^2)/8 + (a - b) 
^2/4))/d + (4*a*b*atanh(tan(c/2 + (d*x)/2)))/d